// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CopyDatabaseStepTest.cs" company="">
//   
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Tests
{
    using ExecutionTool.CopyDatabase;
    using ExecutionTool.Profile;

    using Microsoft.Practices.EnterpriseLibrary.Logging;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Moq;

    [TestClass]
    public class CopyDatabaseStepTest
    {
        #region Public Methods and Operators

        [TestMethod]
        public void CanReturnCorrectStepInfoWhenStarting()
        {
            var profile = new Profile();
            var adapterMock = new Mock<ISqlAzureAdapter>();
            var loggerMock = new Mock<LogWriter>();

            adapterMock.Setup(adapter => adapter.GetDatabaseInfo(It.IsAny<SqlAzureLocation>(), null)).Returns(new SqlAzureDatabaseInfo("Web", "1GB"));

            var step = new CopyDatabaseStep(profile, adapterMock.Object, loggerMock.Object);

            var info = step.Start();

            Assert.AreEqual(SqlAzureDatabaseEdtion.Web, info.DatabaseInfo.Edition);
            Assert.AreEqual(1, info.DatabaseInfo.MaxSizeInGb);
        }

        #endregion
    }
}
